class Student{
    String name;
    int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
public class Main {

    public static void main(String[] args) {
        String str = "hello world";
        String ret = str.toUpperCase();
        System.out.println(ret);
    }
    public static void main10(String[] args) {
        String str = "   hello world   ";
        String ret = str.trim();
        System.out.println(ret);
    }
    public static void main9(String[] args) {
        String str = "helloworld";
        System.out.println(str.substring(5));//截取5到字符串末尾的内容
        System.out.println(str.substring(0, 5));//截取[0~5）下标的内容
    }


    public static void main7(String[] args) {
        String str = "helloworld" ;
        System.out.println(str.substring(5));
        System.out.println(str.substring(0, 5));
    }

    public static void main8(String[] args) {
        String str = "hhh&eee*lll*OOO";
        String[] ret = str.split("\\*");
        for (String a:ret) {
            String[] b = a.split("&");
            for (String c: b) {
                System.out.println(c);
            }
        }
    }
    public static void main6(String[] args) {
        String str = "192\\168\\1\\1";
        String[] ret = str.split("\\\\");
        for (String s: ret) {
            System.out.println(s);
        }
    }
    public static void main5(String[] args) {
        String str = "hhh&ooo&ppp";
        String[] ret = str.split("&",2);
        for (String s:
             ret) {
            System.out.println(s);
        }
    }
    public static void main4(String[] args) {
        String str1 = "aaabbb";
        String str2 = str1.replaceAll("aaa","bbb");
        System.out.println(str2);
    }
        public static void main3(String[] args) {
            String s = String.format("%d-%d-%d", 2019, 9,14);
            System.out.println(s);
        }

    public static void main2(String[] args) {
        String str = "hello";
        char[] ss = str.toCharArray();
        for (char s:
             ss) {
            System.out.print(s);
        }
    }
    public static void main1(String[] args) {
        // 数字转字符串
        String s1 = String.valueOf(1234);
        String s2 = String.valueOf(12.34);
        String s3 = String.valueOf(true);
        String s4 = String.valueOf(new Student("Hanmeimei", 18));
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);
        System.out.println("=================================");
        // 字符串转数字
        // 注意：Integer、Double等是Java中的包装类型，这个后面会讲到
        int data1 = Integer.parseInt("1234");
        double data2 = Double.parseDouble("12.34");
        System.out.println(data1);
        System.out.println(data2);
    }
}